package com.whp.openapi.web.controller;

import com.whp.openapi.common.ResponseResult;
import com.whp.openapi.common.ResultTable;
import com.whp.openapi.entity.ApiSystemparam;
import com.whp.openapi.service.ApiMappingService;
import com.whp.openapi.service.ApiSystemparamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author whp
 * @date 2021/11/26
 */
@RestController
@RequestMapping("/systemparaters")
public class ApiSystemparamController {
    
    @Autowired
    private ApiSystemparamService apiSystemparamService;

    /**
     * 系统参数管理：搜索、分页
     * @param page
     * @param limit
     * @param name
     * @param state
     * @return
     */
    @RequestMapping("/table")
    public ResultTable table(@RequestParam(defaultValue = "1") Integer page,
                             @RequestParam(defaultValue = "10") Integer limit,
                             String name,
                             Integer state){
        return apiSystemparamService.table(page, limit, name, state);
    }

    /**
     * 删除
     * @param ids
     * @return
     */
    @RequestMapping("/del")
    public ResponseResult delApiSystemparam(Integer[] ids){
        return apiSystemparamService.delApiSystemparam(ids);
    }

    /**
     * 添加
     * @param apiSystemparam
     * @return
     */
    @RequestMapping("/add")
    public ResponseResult addApiSystemparam(ApiSystemparam apiSystemparam){
        return apiSystemparamService.addApiSystemparam(apiSystemparam);
    }

    /**
     * 编辑
     * @param apiSystemparam
     * @return
     */
    @RequestMapping("/update")
    public ResponseResult updateApiSystemparam(ApiSystemparam apiSystemparam){
        return apiSystemparamService.updateApiSystemparam(apiSystemparam);
    }
}
